/**
 * 
 */
package com.jushu.storbox.database;

import java.util.List;

import android.content.Context;

import com.jushu.storbox.entities.FileFolderInfo;
import com.jushu.storbox.entities.FolderInfo;
import com.jushu.storbox.entities.ShareINode;
import com.huawei.sharedrive.sdk.android.model.response.INodeShare;
import com.huawei.sharedrive.sdk.android.modelV2.response.INodeShareV2;


public interface IShareINodeDao extends IBaseDao {
	public String TABLE_NAME = "tb_shard_inode";
	
	public String itemViewed = FIELD_ID;
	
	public String TABLE_COMMAND = "Create table " + TABLE_NAME + "(" 
			+ itemViewed			+ " integer,"
			+ id 					+ " text," 
			+ owner_by 				+ " text," 
			+ inodeid 				+ " integer,"
			+ file_name 			+ " text," 
			+ modifiedAt 			+ " integer," 
			+ modified_by			+ " text," 
			+ ownerName 			+ " text," 
			+ ownerId 				+ " integer,"
			+ roleName 				+ " text," 
			+ file_size 			+ " integer," 
			+ status				+ " text," 
			+ type 					+ " text," 
			+ sharedUserId 			+ " integer,"
			+ sharedUserLoginName 	+ " text," 
			+ sharedUserName 		+ " text,"
			+ sharedUserType 		+ " text," 
			+ trans_status 			+ " integer,"
			+ shareDepartment 		+ " text," 
			+ isSync 				+ " integer,"
			+ last_refresh_time 	+ " integer," 
			+ local_path 			+ " text,"
			+ fileIcon 				+ " text," 
			+ "CONSTRAINT pk_tb_shard_inode PRIMARY KEY ("+id+","+owner_by +")"
			+")";
	

	public final static int ITEM_NOT_VIEWED = 0;
	public final static int ITEM_BEEN_VIEWED = 1;
	
	/**
	 * @param folderInfo
	 */
	public void insertFolderOrFile(INodeShareV2 nodeShare);
	
	/**
	 * @param folderInfo
	 */
	public void updateFolderOrFile(INodeShare nodeShare);
	
	/**
	 * @param folderInfo
	 */
	public void insertFolderOrFile(ShareINode nodeShare);
	
	/**
	 * @param folderInfo
	 */
	public void updateFolderOrFile(ShareINode nodeShare);
	
	/**
	 * @param nodeId
	 * @param ownerId
	 */
	public void deleteFolderOrFile(String nodeId, String ownerId);
	
	/**
	 * query some ShareINode
	 * @param resId
	 * @param ownerId
	 * @return
	 */
	public ShareINode getShareINode(String resId, String ownerId);
	
	/**
	 * query some ShareINode 
	 * @param nodeShare
	 * @return
	 */
	public ShareINode getShareINode(INodeShareV2 nodeShare);
	
	/**
	 * @param folderInfo
	 */
	public List<FileFolderInfo> getAllMySharedShip();
	
	/**
	 * @param folderId
	 * @return
	 */
	public List<FileFolderInfo> getFileList(String folderId,String ownerId);
	
	/**
	 * @param folderId
	 * @return
	 */
	public List<FileFolderInfo> getFileList(String folderId, String ownerId2, String des, String orderBy);
	
	/**
	 * @param folderId
	 * @return
	 */
	public List<FileFolderInfo> getFolderList(String folderId, String ownerId2, String des, String orderBy);
	
	
	/**
	 * @param folderId
	 * @return
	 */
	public void deleteFileOrFolder(String folderId,String ownerId);
	
	/**
	 * @param status
	 * @param folder
	 */
	public void updateTransStatus(int status, String folderId,String ownerBy);

	/**
	 * 
	 * @param syncStatus
	 * @param folderId
	 */
	public int updateSyncStatuc(int syncStatus, String folderId,String ownerBy);
	
	public void updateFile(INodeShareV2 nodeShare,boolean issync);
	
	/**
	 * 
	 * @param fileID
	 * @param ownerBy
	 */
	public FileFolderInfo getFileById(String fileID ,String ownerBy);
	
	public void updateLocalPath(String fileId, String ownerBy ,String localPath);
	public void deleteAll();
	/***
	 * @param folderId
	 * @param ownerId
	 * @param nodeShare
	 */
	public void insertOrUpdateShareFolder(Context context,String folderId, String ownerId,
			FolderInfo nodeShare);
	
	/**
	 * @param objectId
	 */
	public long getLastUpdateTime(Context context,String objectId);


	public void cleanCatch();
}
